import Vue from 'vue'
import vuex from 'vuex'
Vue.use(vuex)

//个人信息
const modulesUser={
	state:{
		userCode:"",    //wx.login返回的code值
		userInfo:"",    //用户信息
	},
	mutations:{
		setUserInfo(state,value){
			state.userInfo=value;
		},
		setUserCode(state,value){
		  state.userCode=value;
		},
	},
	actions:{
		setUserInfo(content,value){
		  content.commit('setUserInfo',value)
		},
		setUserCode(content,value){
		  content.commit('setUserCode',value)
		},
	}
}


//首页模块
const modulesIndex={
	state:{
		swiperImg:"",     //首页轮播图的src
	},
	mutations:{
      setSwiper(state,value){
          state.swiperImg=value;
	  },
	},
	actions:{
      setSwiper(content,value){
          content.commit('setSwiper',value)
	  },
	}
}




export default new vuex.Store({
  modules: {
    modulesIndex:modulesIndex,
    modulesUser:modulesUser
  }
})